package com.stock.common.exception;

import lombok.Getter;

/**
 * 自定义异常
 */
@Getter
public class BusinessException extends RuntimeException {

    private int errCode;

    public BusinessException() {
    }


    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(int errCode, Throwable cause) {
        super(cause);
        this.errCode = errCode;
    }

    public BusinessException(int errCode, String message) {
        super(message);
        this.errCode = errCode;
    }

    public static void thrown(String message) {
        throw new BusinessException(message);
    }

    public static void thrown(int errCode, String message) {
        throw new BusinessException(errCode, message);
    }

    public int getErrCode() {
        return errCode;
    }
}
